package com.cleaningcloud.cld.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.cleaningcloud.cld.domain.vo.CldEvaluateVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cleaningcloud.common.log.annotation.Log;
import com.cleaningcloud.common.log.enums.BusinessType;
import com.cleaningcloud.common.security.annotation.RequiresPermissions;
import com.cleaningcloud.cld.domain.CldEvaluate;
import com.cleaningcloud.cld.service.ICldEvaluateService;
import com.cleaningcloud.common.core.web.controller.BaseController;
import com.cleaningcloud.common.core.web.domain.AjaxResult;
import com.cleaningcloud.common.core.utils.poi.ExcelUtil;
import com.cleaningcloud.common.core.web.page.TableDataInfo;

/**
 * 项目/员工评价信息Controller
 * 
 * @author cleaningcloud
 * @date 2025-06-12
 */
@RestController
@RequestMapping("/evaluate")
public class CldEvaluateController extends BaseController
{
    @Autowired
    private ICldEvaluateService cldEvaluateService;

    /**
     * 查询项目/员工评价信息列表
     */
    @RequiresPermissions("cld:evaluate:list")
    @GetMapping("/list")
    public TableDataInfo list(CldEvaluateVo cldEvaluateVo)
    {
        startPage();
        List<CldEvaluateVo> list = cldEvaluateService.selectCldEvaluateList(cldEvaluateVo);
        return getDataTable(list);
    }

    /**
     * 导出项目/员工评价信息列表
     */
    @RequiresPermissions("cld:evaluate:export")
    @Log(title = "项目/员工评价信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CldEvaluateVo cldEvaluateVo)
    {
        List<CldEvaluateVo> list = cldEvaluateService.selectCldEvaluateList(cldEvaluateVo);
        ExcelUtil<CldEvaluateVo> util = new ExcelUtil<CldEvaluateVo>(CldEvaluateVo.class);
        util.exportExcel(response, list, "项目/员工评价信息数据");
    }

    /**
     * 获取项目/员工评价信息详细信息
     */
    @RequiresPermissions("cld:evaluate:query")
    @GetMapping(value = "/{evaluateId}")
    public AjaxResult getInfo(@PathVariable("evaluateId") Long evaluateId)
    {
        return success(cldEvaluateService.selectCldEvaluateByEvaluateId(evaluateId));
    }

    /**
     * 新增项目/员工评价信息
     */
    @RequiresPermissions("cld:evaluate:add")
    @Log(title = "项目/员工评价信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CldEvaluate cldEvaluate)
    {
        return toAjax(cldEvaluateService.insertCldEvaluate(cldEvaluate));
    }

    /**
     * 修改项目/员工评价信息
     */
    @RequiresPermissions("cld:evaluate:edit")
    @Log(title = "项目/员工评价信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CldEvaluate cldEvaluate)
    {
        return toAjax(cldEvaluateService.updateCldEvaluate(cldEvaluate));
    }

    /**
     * 删除项目/员工评价信息
     */
    @RequiresPermissions("cld:evaluate:remove")
    @Log(title = "项目/员工评价信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{evaluateIds}")
    public AjaxResult remove(@PathVariable Long[] evaluateIds)
    {
        return toAjax(cldEvaluateService.deleteCldEvaluateByEvaluateIds(evaluateIds));
    }
}
